<%@ Page Language="C#" MasterPageFile="~/FiledbookMaster.Master" AutoEventWireup="true" CodeBehind="SpeciesList.aspx.cs" Inherits="Fieldbook.Testwebsite.Admin.SpeciesList" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function ShowHideDiv(on, elemID)
        {
            var divElem = document.getElementById(elemID);
            if (on)
            {
                divElem.style.display = "block";
            }
            else 
            {
                divElem.style.display = "none";
            }
            return false;
        }
    </script>
    <a href="#" onclick="return ShowHideDiv(true, 'divAddPlantSpecie')">Add plant specie</a>
    <br />
    <br />
    <asp:Label ID="lblOperationStatus" runat="server" EnableViewState="false"/>
    <div id="divAddPlantSpecie" style="display:none;">
        <table>
            <tr>
                <td>Category: </td>
                <td>
                    <asp:DropDownList ID="ddlPlantSpecieCategory" runat="server" />
                </td>
            </tr>
            <tr>
                <td>Description</td>
                <td><asp:TextBox ID="txtDescription" runat="server"/></td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:LinkButton id="linkAddSpecie" runat="Server" OnCommand="linkAddSpecie_Command" Text="Add"/>
                    <a href="#" onclick="return ShowHideDiv(false, 'divAddPlantSpecie')">Cancel</a>                        
                </td>
            </tr>            
        </table>    
    </div>  
    <asp:GridView ID="dgvSpecies" runat="server" AutoGenerateColumns="false" 
        AllowPaging="False"
        DataSourceID="SpeciesODS">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    Category
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label runat="Server" ID="ExecutorID" Text='<%# Eval("CategoryID") %>'/>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
        </Columns>
    </asp:GridView>

    <asp:ObjectDataSource ID="SpeciesODS" runat="server" TypeName="Fieldbook.Business.PlantSpecieController"
        SelectMethod="LoadAllPlantSpecies">
    </asp:ObjectDataSource>
</asp:Content>
